for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class extends BaseSchema {
protected tableName = 'orders'
public async up () {
this.schema.createTable(this.tableName, (table) => {
table.increments('id')
table.integer('user_id').unsigned().references('users.id').onDelete('CASCADE')
table.integer('product_id').unsigned().references('products.id')
table.string('quantity')
table.tinyint('is_successful', 3).defaultTo(0)
/**
* Uses timestamptz for PostgreSQL and DATETIME2 for MSSQL
*/
table.timestamp('created_at', { useTz: true })
table.timestamp('updated_at', { useTz: true })
})
}
public async down () {
this.schema.dropTable(this.tableName)